<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>齐重后台管理系统</title>
<link rel=stylesheet type=text/css
	href="<%=request.getContextPath()%>/resources/css/backstage/main.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/css/admin/main.css"/>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/engine.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/interface/dwrService.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/jquery-1.7.2.min.js"></script>
	<link rel=stylesheet type=text/css
	href="<%=request.getContextPath()%>/resources/css/backstage/back-nav.css">
<script type=text/javascript
	src="<%=request.getContextPath()%>/resources/js/backstage/back-nav.js"></script>
	
<style>
.clear {
	width: 80px;
	height: 30px;
	background-color: purple;
	color: white;
	margin-left: 30px;
	cursor: pointer;
}

.clear:HOVER {
	background-color: grey;
}
</style>
<script type="text/javascript">
	$(function() {
		$(".clear")
				.click(
						function() {
							var path = $("#ctx").val();
							$(this)
									.append(
											"<img src='"+path+"/qzsk/images/wait.gif' width='30px' height='30px' style='position:absolute;margin-left:80px;'>");
							var total = $(".total").val();
							var total1 = $(".total1").val();
							for (var i = 1; i <= total; i++) {
								dwrService.delUnUseFiles($(
										"#listTable ." + i + "").html());
								$("#listTable ." + i + "").parent().remove();
							}
							for (var i =parseInt(total)+1; i <= total1; i++) {
								dwrService.delUnUseIndexFiles($(
										"#listTable1 ." + i + "").html());
								$("#listTable1 ." + i + "").parent().remove();
							}
							$('.clear img').remove();
						});
	});
</script>
</head>
<body>

	<input type="hidden" id="ctx" value="<%=request.getContextPath()%>" />
<jsp:include page="/jsp/admin/top.jsp"></jsp:include>
<div class="content-box">
<jsp:include page="/jsp/admin/nav.jsp"></jsp:include>
	<div id="content">
		<div class="clear">一键清理</div>
		<%
			int i = 0;
		%>
		
		<table width="800" cellspacing="0" cellPadding="0" id="listTable">
		<thead>
		<tr><td>文章中垃圾文件：</td><td></td><td></td></tr>
		</thead>
			<tbody>
				<c:forEach items="${unUseFiles}" var="f">
					<%
						++i;
					%>
					<tr>
						<td><%=i%></td>
						<td>未引用的垃圾附件</td>
						<td class="<%=i%>">${f }</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<input type="hidden" value="<%=i%>" class=" total" />
		
		<table width="800" cellspacing="0" cellPadding="0" id="listTable1">
		<thead>
		<tr><td>首页图片中垃圾文件：</td></td><td></td><td></td></tr>
		</thead>
			<tbody>
				<c:forEach items="${unUseIndexFiles}" var="fi">
					<%
						++i;
					%>
					<tr>
						<td><%=i%></td>
						<td>未引用的垃圾附件</td>
						<td class="<%=i%>">${fi}</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<input type="hidden" value="<%=i%>" class=" total1" />
	</div>
	</div>
</body>
</html>